class CreateTimelinePluginRegisters < ActiveRecord::Migration
  def self.up
    create_table :timeline_plugin_registers do |t|

    t.integer :owner_user_id, :null => false
    t.integer :timeline_config_id
    t.boolean :is_non_configurable
    t.string :url_list
    t.string :top_time_unit
    t.string :bottom_time_unit
    t.integer :top_pixels
    t.integer :bottom_pixels
	  t.string :title
    t.text :timeline_js
    t.string :description
    t.string :controller_name
    t.string :index_action
    t.timestamps
    end

  #  execute "alter table timeline_plugin_registers
   #            add constraint fk_timeline_plugin_registers_users
    #           foreign key  (user_id) references users(id)"

    execute "alter table timeline_plugin_registers
               add constraint fk_timeline_events_timeline_configs
               foreign key  (timeline_config_id) references timeline_configs(id)"

  end

  def self.down
    drop_table :timeline_plugin_registers
  end
end
